﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">

    <!-- Fonts -->
    <link href='http://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic,greek,vietnamese' rel='stylesheet' type='text/css'>

    <title></title>
    <meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui" />
    <link rel="shortcut icon" href="favicon.ico" />
    <link rel="stylesheet" href="css/vrs-common.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/vrs-desktop.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/jquery-ui/jquery-ui.css" type="text/css" media="screen" />

    <!-- [[ JS BUNDLE START ]] -->
    <!-- 3rd party javascript libraries and plugins -->
    <script src="script/jquery.js" type="text/javascript"></script>
    <script src="script/globalize.js" type="text/javascript"></script>
    <script src="script/jquery-ui.js" type="text/javascript"></script>
    <script src="script/jquery.ui.touch-punch.js" type="text/javascript"></script>
    <script src="script/jstorage.js" type="text/javascript"></script>

    <!-- VRS modules that are used by everything -->
    <script src="script/vrs/enums.js" type="text/javascript"></script>
    <script src="script/vrs/string.js" type="text/javascript"></script>
    <script src="script/vrs/event.js" type="text/javascript"></script>
    <script src="script/vrs/scriptManager.js" type="text/javascript"></script>
    <script src="script/vrs/serverConfiguration.js" type="text/javascript"></script>
    <script src="script/vrs/configStorage.js" type="text/javascript"></script>
    <script src="script/i18n/localise.js" type="text/javascript"></script>
    <script src="script/vrs/utility.js" type="text/javascript"></script>

    <!-- jQuery UI plugins -->
    <script src="script/jquiplugin/jquery.vrs.localeSelect.js" type="text/javascript"></script>

    <!-- [[ BUNDLE END ]] -->
</head>
<body>
    <h1></h1>

    <ul>
        <li><input id="noForce"         type="radio" name="force" value="--"><label for="noForce"></label></li>
        <li><input id="forceTabletOn"   type="radio" name="force" value="ty"><label for="forceTabletOn"></label></li>
        <li><input id="forceTabletOff"  type="radio" name="force" value="tn"><label for="forceTabletOff"></label></li>
        <li><input id="forcePhoneOn"    type="radio" name="force" value="py"><label for="forcePhoneOn"></label></li>
        <li><input id="forcePhoneOff"   type="radio" name="force" value="pn"><label for="forcePhoneOff"></label></li>

        <li><a id="desktopLink" href="desktop.html"></a></li>
        <li><a id="mobileLink" href="mobile.html"></a></li>
        <li><a id="settingsLink" href="settings.html"></a></li>
        <li><a id="desktopReportLink" href="desktopReport.html"></a></li>
        <li><a id="mobileReportLink" href="mobileReport.html"></a></li>
        <li><a id="fsxLink" href="fsx.html"></a></li>
    </ul>

    <script type="text/javascript">
        var VRS = window.VRS = window.VRS || {};
        VRS.globalOptions = VRS.globalOptions || {};
        jQuery(document).ready(function($) {
            VRS.configStorage.setPrefix('index');
            VRS.configStorage.cleanupOldStorage();
            VRS.globalisation.loadAndApplyState();

            var originalLinks = {};
            $.each($('a'), function() {
                var link = $(this);
                originalLinks[link.attr('id')] = link.attr('href');
            });

            showTranslatedText();

            $('input[name="force"]').on('click', forceSettingChanged);
            $('#noForce').prop('checked', true);

            function showTranslatedText()
            {
                $('h1').text(VRS.$$.Index);
                $('label[for="noForce"]').text(VRS.$$.None);
                $('label[for="forceTabletOn"]').text(VRS.$$.ForceTabletOn);
                $('label[for="forceTabletOff"]').text(VRS.$$.ForceTabletOff);
                $('label[for="forcePhoneOff"]').text(VRS.$$.ForcePhoneOff);
                $('label[for="forcePhoneOn"]').text(VRS.$$.ForcePhoneOn);
                $('#desktopLink').text(VRS.$$.DesktopPage);
                $('#mobileLink').text(VRS.$$.MobilePage);
                $('#settingsLink').text(VRS.$$.SettingsPage);
                $('#desktopReportLink').text(VRS.$$.DesktopReportPage);
                $('#mobileReportLink').text(VRS.$$.MobileReportPage)
                $('#fsxLink').text(VRS.$$.FlightSimPage);
            }

            function forceSettingChanged()
            {
                var queryString = null;

                var checkedValue = $('input[name="force"]:checked').first().val();
                switch(checkedValue) {
                    case 'ty':      queryString = 'tablet=1'; break;
                    case 'tn':      queryString = 'tablet=0'; break;
                    case 'py':      queryString = 'phone=1'; break;
                    case 'pn':      queryString = 'phone=0'; break;
                }

                for(var id in originalLinks) {
                    var href = originalLinks[id];
                    var link = $('#' + id);
                    link.attr('href', href + (queryString ? '?' + queryString : ''));
                }
            }
        });
    </script>
</body>
</html>